//
//  UIView+dodoAnimation.m
//  TravelGuideMdd
//
//  Created by 陈曦 on 13-7-17.
//  Copyright (c) 2013年 mafengwo.com. All rights reserved.
//

#import "UIView+duduAnimation.h"

@implementation UIView(duduAnimation)

#define MAKE_ANIMAT(x,y) ([NSValue valueWithCATransform3D:CATransform3DMakeScale(x,y,1)])


- (void)duduAnimation
{
    CAKeyframeAnimation *keyFrame = [CAKeyframeAnimation animationWithKeyPath:@"transform"];;
    
    keyFrame.values = @[
                        MAKE_ANIMAT(0.1, 0.1),
                        MAKE_ANIMAT(1.0, 1.0),
                        MAKE_ANIMAT(1.15, 0.85),
                        MAKE_ANIMAT(0.9, 1.1),
                        MAKE_ANIMAT(1.15, 0.97),
                        MAKE_ANIMAT(0.975, 1.025),
                        MAKE_ANIMAT(1, 1)
                        ];
    
    keyFrame.duration = 0.4;
    keyFrame.fillMode = kCAFillModeForwards;
    keyFrame.removedOnCompletion = YES;
    
    [self.layer addAnimation:keyFrame forKey:@"duduAnimation"];
}

- (void)duduRemoveAnimation
{
    
}

@end
